package com.tongcao.cn.service.impl;

import com.tongcao.cn.domain.dataobject.User;
import com.tongcao.cn.mapper.UserMapper;
import com.tongcao.cn.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;

/**
 * @author:tongcao
 * @since:2019/8/8 16:01
 * Description:
 */

@Service
public class UserService implements IUserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> getUserList() {
        final List<User> userList = userMapper.getUserList();
        return Optional.of(userList).orElse(null);
    }

    @Override
    public void insert(User user) {
        userMapper.insert(user);
    }
}